<div class="right_side_operate_area">
	<div>
		<?php  
			$user=$session->read('User');
			if($showpage==1) {
				if(isset($paging)){ echo $this->renderElement('pagination',$paging);} 
			}
		?>
		<div class="right_side_title left">
			<h2><?php echo $tname?></h2>
			<?php $actions=$this->action;?>
			<?php echo $html->link("编辑","/searchs/set".$actions."/".$tech,array("class"=>"user_link"))?>
		</div>
      	<div class=" right_side_title right" style="margin-top:10px;">
	         <?php 
			 if($user['isadmin']||$user['isvisitor']){
				$grouplist=array_merge(array(""=>"请选择模块"),$grouplist);
		    	echo $form->select('ddlgroup',$grouplist,$group_mod_id, null,null);//$group_mod_id
			 }
		     ?>
	    </div>
    	<div class="clear"></div>
	</div>
	<?php if($strdesc){
		$strdesc=ltrim($strdesc,"，")."。";
		?>
	<div class="right_sidt_head_screen">
		<div class="right_side_head_line">
			<div class="match_condition_desc" style="float:left;">
				<span>符合条件：</span>
				<label id="subdec" title="<?php echo $strdesc?>">
				<?php 
				    echo $str->sub_len($strdesc,60);
				?>
				</label>
				<?php if($str->isetc){?>
				<label id="desc" style="display:none"><?php echo  $strdesc?></label>
				<a onclick="showdesc(this)" href="javascript:void(0)">展开</a>
				<script>
					function showdesc(obj){
						var desc=$("#desc").css("display");
						if(desc=="none"){
							$("#subdec").css("display","none");
							$("#desc").css("display","");
							$(obj).html("收缩");
						}else{
							$("#desc").css("display","none");
							$("#subdec").css("display","");
							$(obj).html("展开");
						}
					}
				</script>
				<?php }?>

				
			</div>
			<?php if($desc){?>
			<div class="match_condition_desc">
				<span>描述信息：</span>
				<?php echo $desc ?>
			</div>
			<?php }?>
    	<div style="height:20px;text-align:center;cursor: pointer;">
    		<div class="form_right_add left">
                	<div id="taglist" class="added_item_list left"></div>
                    <div class="add_item_btn left">
	                    <a id="add_drop_float_clickct" href="javascript:void(0)">列名</a>
		                <div id="add_float_boxct" class="add_float_box" style="display:none;z-index:10000;">
		                    <ul>
			                    <?php 
			                    $colarray = explode(",",$colstr);
			                   // debug($colarray);
			                    $dan="'";
			                    foreach($selectcolumns as $key=>$column){
			                    	$checked = "";
			                    	//debug(in_array($key, $colarray));
			                    	if(in_array($key, $colarray)){
			                    		$checked = "checked=true";
			                    	}
									echo "<li><label>";
									echo '<input type="checkbox" id="'.$key.'" '.$checked.' />'.$column;
									echo "</label></li>";
									echo "<span id='".$key."' class='txthide'>".$column."</span>";
								}?> 
							</ul>
<!--							<div id="colstr" style="display:none"><?php echo $colstr?></div>-->
							<div class="right item_add_btn">
								<a onclick="selectcolumn()" href="javascript:void(0)" style="padding-left:0px;">确定</a>
‌							</div>
		                </div>
					</div>
                </div>

        </div>
		</div>
	</div>
	<?php }?>
</div>
<div class="clear"></div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
        <div class="items_list">
        	<?php 
       			$upimg=$html->image("up.png");
				$downimg=$html->image("down.png");
				$capitalimg=$capitalsort=="desc"?$upimg:$downimg;
				$regimg=$regsort=="desc"?$upimg:$downimg;
				
				//debug($colarray);
       		?>
        	<table>
            	<tr>
                    <th>企业名称</th>
                    <th>模块</th>
                    <?php 
                    foreach ($colarray as $col){
                    	
                    	if($col=='capital'){
                    ?>
                    		<th><?php echo $html->link('注册资金（万）'.$capitalimg,'/searchs/'.$actions.'/'.$tech.'/capital/'.$capitalsort,array('escape' => false))?></th>
                    <?php 
                    	}else if($col=='reg_time'){
                    ?>
                    		<th><?php echo $html->link('注册时间'.$regimg,'/searchs/'.$actions.'/'.$tech.'/reg_time/'.$regsort,array('escape' => false))?></th>
                    <?php		
                    	}else{
                    		echo '<th>'.$selectcolumns[$col].'</th>';
                    	}
                    }
                    ?>
                </tr>
                <?php 
				foreach($companys as $company){
					$id=$company["SearchCompany"]["id"];
					$company_name=$company["SearchCompany"]["company_name"];
					$groupname=$grouplist[$company["SearchCompany"]["groupid"]];
					
					echo "<tr class='per_list'>";
					echo "<td>".$html->link($str->sub_len($company_name,20),"/companys/showinfosummary/".$id,array("title"=>$company_name),null)."</td>";
					echo "<td>".$groupname."</td>";
					foreach($colarray as $k=>$v){
						if($v == 'person'){
							$personcount = count($company["SearchPerson"]);
							echo "<td>".$personcount."</td>";
						}else if($v == 'patent'){
							$patentcount = count($company["CompanyPatent"]);
							echo "<td>".$patentcount."</td>";
						}else if($v == 'income'){
							echo "<td>".$company["CompEconomic"][0]['general_income']."</td>";
						}else if($v == 'capital'){
							$cap_type=$company["SearchCompany"]["cap_type"]=="0"?"￥":"＄";
							echo "<td>".$cap_type.$company["SearchCompany"]["capital"]."</td>";
						}else if($v == 'reg_time'){
							$reg_time=$company["SearchCompany"]["reg_time"];
							if(!empty($reg_time)){
								$reg_time=date("Y-m-d",strtotime($reg_time));
							}
							echo "<td>".$reg_time."</td>";	
						}else{
							echo "<td>".$company["SearchCompany"][$v]."</td>";
						}
					}
					
					
//					echo "<td>".$company["SearchCompany"]["contact"]."</td>";
//					echo "<td>".$company["SearchCompany"]["tel"]."</td>";
//					$cap_type=$company["SearchCompany"]["cap_type"]=="0"?"￥":"＄";
//					echo "<td>".$cap_type.$company["SearchCompany"]["capital"]."</td>";
//					$reg_time=$company["SearchCompany"]["reg_time"];
//					if(!empty($reg_time)){
//						$reg_time=date("Y-m-d",strtotime($reg_time));
//					}
//					echo "<td>".$reg_time."</td>";	
//					echo "</tr>";
				}?>
            </table>
		</div>
    </div>
</div>
<script>
$(document).ready(function() {
	$("#ddlgroup").change(function(){
		searchtech();
		});	
});
function searchtech()
{
	var str1=new Array();
	var str2=new Array();
	var url_before=window.location.href;
	str1=url_before.split('searchs/');
	str2=str1[1].split('?');
	
	var webpath=$("#getpath").attr('href');
	var urlpath=webpath+"searchs/"+str2[0]+"?seach=all";
	var group=$("#ddlgroup").val();
	if(group==""){
		location.href=urlpath;
	}else{
		if(group!=""){
			urlpath+="&group="+group;
			}
		location.href=urlpath;
	}
	return false;

}

function selectcolumn(){
	var colstr = "";
	var webpath=$("#getpath").attr('href');
    var urlpath=webpath+"searchs/techfilter/<?php echo $tech?>";
	$("#add_float_boxct li span").each(function(){
		if($(this).attr("class")=="checked"){
			colstr +=$(this).find("input").attr("id")+",";
		}
	});
	//$("#colstr").html(colstr);
	if(colstr==""){
        location.href=urlpath;
    }else{
        if(colstr.trim()!=""){
            urlpath+="?colstr="+encodeURIComponent(colstr.trim());
        }
        location.href=urlpath;
    }
    return false;
}


function addEV(C,B,A){
	if(window.attachEvent){
		C.attachEvent("on"+B,A);
	}else{
		if(window.addEventListener){
			C.addEventListener(B,A,false);
		}
	}
}
addEV(document,"click",function(E){
	var E=E||window.event;
	var A=E.target||E.srcElement;
	var D=window.event?E.button:E.which;
	var C=G("add_drop_float_click"),B=G("add_float_box");
	while(A&&A!=document.body&&A.tagName.toLowerCase()!="html"){
		if(A==C){break}
		if(A==B){break}
		A=A.parentNode
	}
	if(A==B){
		if(B!=null){
			B.style.display="block";
		}
	}else if(A!=C){
		if(B!=null){
			B.style.display="none";
		}
	}else{
		if(D<2){
			B.style.display=B.style.display=="block"?"none":"block";
		}
	}
});
function addEVct(C,B,A){
	if(window.attachEvent){
		C.attachEvent("on"+B,A);
	}else{
		if(window.addEventListener){
			C.addEventListener(B,A,false);
		}
	}
}
addEVct(document,"click",function(E){
	var E=E||window.event;
	var A=E.target||E.srcElement;
	var D=window.event?E.button:E.which;
	var C=G("add_drop_float_clickct"),B=G("add_float_boxct");
	while(A&&A!=document.body&&A.tagName.toLowerCase()!="html"){
		if(A==C){break}
		if(A==B){break}
		A=A.parentNode
	}
	if(A==B){
		if(B!=null){
			B.style.display="block";
		}
	}else if(A!=C){
		if(B!=null){
			B.style.display="none";
		}
	}else{
		if(D<2){
			B.style.display=B.style.display=="block"?"none":"block";
		}
	}
});
</script>